#include <boost/python.hpp>
#include <boost/python/suite/indexing/map_indexing_suite.hpp>
#include <boost/python/suite/indexing/vector_indexing_suite.hpp>
#include "UserConfigReader.h"
#include "BrokerConfigReader.h"

BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(ConfigReader_Load_overloads, ConfigReader::Load, 0, 2)
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(UserConfigReader_Load_overloads, UserConfigReader::Load, 0, 2)
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(BrokerConfigReader_Load_overloads, BrokerConfigReader::Load, 0, 2)

BOOST_PYTHON_MODULE(ConfigLib)
{
	using namespace boost::python;

	class_<std::map<std::string, UserLoginParam> >("UserLoginParamMap")
		.def(map_indexing_suite<std::map<std::string, UserLoginParam> >());

	class_<std::map<std::string, int> >("StrIntMap")
		.def(map_indexing_suite<std::map<std::string, int> >());

	class_<std::vector<std::string> >("StrVector")
		.def(vector_indexing_suite<std::vector<std::string> >());

	class_<std::vector<StrategyParam> >("StrategyParamVector")
		.def(vector_indexing_suite<std::vector<StrategyParam> >());


	class_<ConfigReader>("ConfigReader")
		.def("Load", &ConfigReader::Load, ConfigReader_Load_overloads(args("config_file","bForceLoad"),
			"Load from file and if bForceLoad reload file"))
		.def("UnLoad", &ConfigReader::Unload)
		.def("GetFileName", &ConfigReader::GetFileName)
		;

	class_<UserConfigReader,bases<ConfigReader> >("UserConfigReader")
		.def("Load", &UserConfigReader::Load, UserConfigReader_Load_overloads(args("config_file", "bForceLoad"),
			"Load from file and if bForceLoad reload file"))
		.def("GetUsers", &UserConfigReader::GetUsers, return_value_policy<reference_existing_object>())
		.def("GetStrtegyParams", &UserConfigReader::GetStrtegyParams, return_value_policy<reference_existing_object>())
		.def("GetInstance", &UserConfigReader::GetInstance, return_value_policy<reference_existing_object>())
 		.staticmethod("GetInstance")
		;

	class_<BrokerInfoMap >("BrokerInfoMap")
		.def(map_indexing_suite<BrokerInfoMap >())
		;

	class_<BrokerConfigReader, bases<ConfigReader> >("BrokerConfigReader")
		.def("Load", &BrokerConfigReader::Load, BrokerConfigReader_Load_overloads(args("config_file", "bForceLoad"),
			"Load from file and if bForceLoad reload file"))
		.def("GetBrokers", &BrokerConfigReader::GetBrokers, return_value_policy<reference_existing_object>())
		.def("GetInstance", &BrokerConfigReader::GetInstance, return_value_policy<reference_existing_object>())
 		.staticmethod("GetInstance")
		;
}